package com.atguigu.serviceedu.service.impl;

import com.atguigu.serviceedu.entity.CmsAdEntity;
import com.atguigu.serviceedu.entity.EduChapter;
import com.atguigu.serviceedu.mapper.CmsAdMapper;
import com.atguigu.serviceedu.mapper.EduChapterMapper;
import com.atguigu.serviceedu.service.CmsAdService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class CmsAdServiceImpl extends ServiceImpl<CmsAdMapper, CmsAdEntity>  implements CmsAdService {

    @Override
    @Cacheable(value = "index",key = "'getAdByTypeId'")
    public List<CmsAdEntity> getAdByTypeId(String typeId) {
        QueryWrapper<CmsAdEntity> wrapper = new QueryWrapper<>();
        wrapper.eq("type_id",typeId);
        List<CmsAdEntity> cmsAdEntityList = baseMapper.selectList(wrapper);
        return cmsAdEntityList;
    }
}
